<?php

namespace App\Http\Controllers;

use DB;
use Storage;
use Session;
use Illuminate\Http\Request;
use Laravel\Lumen\Routing\Controller;


class ModelController extends BaseController
{
	/**
     * @api {get} /invitation GetModel
     *
     * @apiVersion 0.1.0
	*
     * @apiName GetModel
 	*
     * @apiGroup invitation
	*
     * @apiPermission app
 	*
 	*
     * @apiSuccess {Boolean} error       是否错误.
 	*
     * @apiSuccess {Object} result       模板数据.
 	*
     * @apiSuccess {int} category_id     所属分类id.
     *
     * @apiSuccess {Int} model_id        模板id.
 	*
 	*@apiSuccess {String} name          模板名称.
     *
     * @apiSuccess {String} url_name     url处模板名称.
 	*
     * @apiSuccess {String} img_dir      模板展示图片地址.
 	*
     * @apiError paramError 参数错误.
 	*
     * @apiSampleRequest http://192.168.1.120:82/api/team
 	*
     */

	public function index()
	{   

          $result = DB::table("model")
          ->join("category","category.id","=","model.category_id")
          ->select( "model.id As model_id",
                    "model.name",
                    "model.demo_id",
                    "model.dir_name",
                    "model.img_dir",
                    "category.id As category_id")
          ->where("model.is_delete",0)
          ->get();
          return $this->jsonResponse(false,$result);

	}

	public function show($id)
	{
		# code...
	}

	public function store()
	{
		# code...
	}

	public function update($id)
	{
		# code...
	}

	public function destory($id)
	{
		# code...
	}
}